﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BookiFramework.Files
{
    public class FileReader
    {
        /// <summary>
        /// Read the text content of the file
        /// </summary>
        /// <param name="fileName">path of the file to open</param>
        /// <returns>text content of the file</returns>
        public string ReadTextFromFile(string fileName)
        {
            if(!File.Exists(fileName)) throw new FileNotFoundException("The file especifed was not found.");
            
            using (var stream = new FileStream(fileName, FileMode.Open))
            {
                return new Files().ReadText(stream);
            }
        }
    }
}
